<?php

namespace app\school\controller;

use library\Controller;
use think\Db;

class Banner extends Controller
{
    public $table = 'sunshineBanner';
    public $title = '轮播图管理';
    public function __construct()
    {
        parent::__construct();
        $this->base_route = rtrim(url('',false,false), $this->request->action());
    }
    public function index()
    {
        if($this->request->request('name')){
            $name = $this->request->request('name');
        }else{
            $name = '';
        }
        return $this->_page(Db::name($this->table)->where('name','like','%'.$name.'%'));
    }

    public function add()
    {
        return $this->_form($this->table, 'form');
    }

    public function edit()
    {
        return $this->_form($this->table, 'form');
    }

    public function del()
    {
        return $this->_delete($this->table);
    }

    public function _form_filter(&$data){

    }

    private function navigate()
    {

    }

    public function upstatus(){
        $this->_save($this->table, [
            'status' => $this->request->request('status'),
        ],'id', ['id' => $this->request->request('id')]);
    }
}
